<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//声明数组，并存储若干水果，计算其长度，并遍历打印输出
			var fruits = ["草莓", "青提", "西瓜", "哈密瓜"];
			console.log(fruits.length);
			//1
			for (var i = 0; i < fruits.length; i++) {
				document.write(fruits[i]);
				document.write("<br />");
			}
			//2
			for (var j = 0, len = fruits.length; j < len; j++) {
				document.write(fruits[j]);
				document.write("<br />");
			}
		</script>
	</body>
</html>
